package com.example.basiclib.application;

import android.content.Context;
import android.support.annotation.Keep;

import com.jess.arms.http.GlobalHttpHandler;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import timber.log.Timber;

@Keep
public class GlobalHttpHandlerImpl implements GlobalHttpHandler {
    private Context context;
    private String locality = "";

    public GlobalHttpHandlerImpl(Context context) {
        this.context = context;
    }

    @Override
    public Response onHttpResultResponse(String httpResult, Interceptor.Chain chain, Response response) {
        Timber.tag("http").d("Result ------> " + response.request().url());
        Timber.tag("http").d("Result ------> " + httpResult);
        return response;
    }

    // 这里可以在请求服务器之前可以拿到request
    @Override
    public Request onHttpRequestBefore(Interceptor.Chain chain, Request request) {
        return request;
    }
}
